import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

function storeLocalStore (state) {
    window.localStorage.setItem("testMsg",JSON.stringify(state));
}
const store = new Vuex.Store({
    state: {
        radioD: '',
        multipleD: '',
        drawer:'false',
        list: [],
        totList: [],
        questionId: '',
        titleId: '',
        totalScore: 0,
        paperTitle:'',
        currentTitle: '',//exam表数据
        currentExam: '',//question表数据
        content: '',
        reportDate: '',
        num: '',
        showReport: '',
        name:0,
        sex:0,
        stuNum: 0,
        major:0,
        tClass:0,
        tianK:0,
        ask:0,
        panD:0,
        release:0,
        examId:'',
        listQ:'',
        listE:''
    },
    mutations: {
        getRadio(state, payload){
            state.radioD = payload.radioD;
        },
        getMultiple(state, payload){
            state.multipleD = payload.multipleD;
        },
        showDrawer(state,payload){
            state.drawer = payload;
        },
        getList(state,payload){
            state.list = payload;
        },
        getName(state, payload){
            state.name = payload.name;
        },
        getSex(state, payload){
            state.sex = payload.sex;
        },
        getStuNum(state, payload){
            state.stuNum = payload.stuNum;
        },
        getMajor(state, payload){
            state.major = payload.major;
        },
        getClass(state, payload){
            state.tClass = payload.tClass;
        },
        getTianK(state, payload){
            state.tianK = payload.tianK;
        },
        getAsk(state, payload){
            state.ask = payload.ask;
        },
        getPanD(state, payload){
            state.panD = payload.panD;
        },
        getId(state,payload){
            state.questionId = payload;
        },
        getTitleId(state,payload){
            state.titleId = payload;
        },
        getTotalScore(state,payload){
            state.totalScore = payload;
        },
        getTotList(state,payload){
            state.totList = payload;
        },
        getPaperTitle(state,payload){
            state.paperTitle = payload;
        },
        getPubClick(state,payload){
            state.release = payload.release;
        },
        getCurrentExam(state,payload){
            state.currentExam = payload;
            storeLocalStore (state);
        },
        getCurrentTitle(state,payload){
            state.currentTitle = payload;
            storeLocalStore (state)
        },
        getExamId(state, payload){
            state.examId = payload.examId;
        },
        getListQ(state, payload){
            state.listQ = payload;
        },
        getOneExam(state, payload){
            state.listE = payload;
        },
        getContent(state, payload){
            state.content = payload;
        },
        getReport(state, payload){
            state.reportDate = payload;
            storeLocalStore (state)
        },
        getNum(state,payload){
            state.num = payload
        },
        getShowReport(state, payload){
            state.showReport = payload
        },


    }
});
export default store;
